<?php
class RM_User_DepositController extends RM_Controller {
    public function selectJsonAction() {
        $total = (float)$this->_getParam('total', null);

        $depositModel = new RM_Deposit;
        $depositSettings = $depositModel->getSettings();

        $deposit = array(
            'force' => $depositSettings->force,
            'enabled' => $depositSettings->enabled,
            'value' => $depositSettings->calculate($total)
        );

        return array(
            'data' => array('deposit' => $deposit)
        );
    }

    public function useJsonAction(){
        $plugin = new RM_Plugin_Deposit();
        $plugin->useDepositFor(RM_Reservation_Manager::getInstance()->getReservationID());
    }

    public function removeJsonAction(){
        $plugin = new RM_Plugin_Deposit();
        $plugin->dontUseDepositFor(RM_Reservation_Manager::getInstance()->getReservationID());        
    }
}